<form id="<?php echo $uniqid;?>" method="post" style="padding: 8px;">
    <table border="0" width="100%" cellspacing="1" cellpadding="5" class="formtable">
        <tr>
            <td class="tlabel" width="20%">标题：</td>
            <td width="80%"><input name="title" type="text" style="width:400px;"
                                   class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox"
                                   placeholder="请输入标题.." required="true" v-model="params.title"></td>
        </tr>
        <tr>
            <td class="tlabel">类别：</td>
            <td width="80%">
                <template v-for="(vo,index) in imagesCat">
                    <label style="padding-right: 20px;"><input name="type" type="radio" class="textbox-prompt"
                                                               :value="vo.id" v-model="params.type">{{vo.title}}</label>
                </template>
            </td>
        </tr>
        <tr v-if="params.type==2">
            <td class="tlabel">广告链接：</td>
            <td width="80%"><input name="links" type="text" style="width:400px;"
                                   class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox"
                                   placeholder="请输入广告链接.." v-model="params.links"></td>
        </tr>
        <tr v-if="params.type==2||params.type==3">
            <td class="tlabel">关联专题ID：</td>
            <td width="80%"><input name="special_id" type="text" style="width:200px;"
                                   class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox"
                                   placeholder="请输入专题ID.." v-model="params.special_id"></td>
        </tr>
        <tr v-if="params.type==2||params.type==3">
            <td class="tlabel">关联商品ID：</td>
            <td width="80%"><input name="goods_id" type="text" style="width:200px;"
                                   class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox"
                                   placeholder="请输入商品ID.." v-model="params.goods_id"></td>
        </tr>
        <tr>
            <td class="tlabel">排序：</td>
            <td width="80%"><input name="sortorder" type="text"
                                   class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox"
                                   placeholder="请输入排序.." v-model="params.sortorder"></td>
        </tr>
        <tr>
            <td class="tlabel">状态：</td>
            <td width="80%"><label><input name="status" type="checkbox" class="textbox-prompt" v-model="params.status">激活</label></td>
        </tr>
        <tr>
            <td class="tlabel">图片：</td>
            <td width="80%">
                <div title="上传图片">
                    <div class="col-md-12">
                        <div id="container" style="background-color:#F9F9F4">
                            <a class="btn btn-default btn-lg" id="imagesPickfiles<?php echo $uniqid;?>" href="#" style="text-decoration: none;">
                                <div style="padding:20px;"><i class="iconfont icon-xiangji"></i> 点击上传图片...</div>
                            </a>
                        </div>
                    </div>
                    <div style="display:none" id="success" class="col-md-12">
                        <div class="alert-success">
                            队列全部文件处理完毕
                        </div>
                    </div>
                    <div class="col-md-12 ">
                        <table id="uploadtable" class="formtable" id="fsUploadProgressTable1">
                            <tbody id="fsUploadProgress">
                            <template v-if="params.image">
                            <tr style="opacity: 1;">
                                <td class="progressName">
                                    <a class="linkWrapper" target="_blank"
                                       href="params.image" title="查看原图"><img
                                            width="100%" :src="params.image+'?imageView2/1/w/100/h/100'"></a>
                                </td>
                                <td>
                                    <div class="info" style="display: flex">
                                        <div style="flex: 4"><span>{{params.image}}</span></div>
                                        <div style="flex: 1">
                                            <input class='l-btn l-btn-small btn-del'
                                                   @click="rm()"
                                                   value="删除图片" type="button">
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            </template>
                            </tbody>
                        </table>
                    </div>
                </div>
            </td>
        </tr>
    </table>
</form>
<script>
    var imageseditVm = new Vue({
        el: '#<?php echo $uniqid;?>',
        data: {
            params: JSON.parse('<?php echo addslashes($dataset);?>'),
            imagesCat: [],
        },
        methods: {
            init: function () {
                $.post('/admin/index/imagesCatGet', {}, function (data) {
                    imageseditVm.imagesCat = data.rows;
                });
            },
            rm() {
                $.messager.confirm('确认对话框', '您确认删除么？', function (r) {
                    if (r) {
                        imageseditVm.params.image = '';
                    }
                });
            }
        }
    });
    imageseditVm.init();
    $(function () {
        $('#<?php echo $uniqid;?> #imagesEditsubmit').click(function () {
            $.post('/admin/index/imagesedit', imageseditVm.params, function (data) {
                if (parseInt(data.ret) === 0) {
                    $.messager.show({
                        title: '提示',
                        msg: data.msg,
                        timeout: 3000,
                        showType: 'slide'
                    });
                    $('#imageseditfm').form('clear');
                    $("#imagesdlg").dialog('close');
                    $("#images").datagrid('reload');
                } else {
                    $.messager.alert('提示', data.msg, 'warning');
                }
            }, 'json');
        });
        qiniu_single('imagesPickfiles<?php echo $uniqid;?>', function (res) {
            imageseditVm.params.image = '';
            imageseditVm.params.image = res;
        });
    });
</script>
